package com.bqjr.cloud.zuul.model;

import java.io.Serializable;

import javax.persistence.Id;
import javax.persistence.Table;

@Table(name = "zuul_server")
public class ServerInfo implements Serializable, Comparable<ServerInfo> {

	private static final long serialVersionUID = -5164369072287481037L;

	@Id
	private String id;
	private String host;
	private Integer port;
	private Integer weight;
	private String serviceId;
	private Boolean isEnabled;
	private String version;
	private String policyType;
	private String policyValue;
	private String description;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public Integer getPort() {
		return port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	public String getServiceId() {
		return serviceId;
	}

	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}

	public Boolean getIsEnabled() {
		return isEnabled;
	}

	public void setIsEnabled(Boolean isEnabled) {
		this.isEnabled = isEnabled;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getPolicyType() {
		return policyType;
	}

	public void setPolicyType(String policyType) {
		this.policyType = policyType;
	}

	public String getPolicyValue() {
		return policyValue;
	}

	public void setPolicyValue(String policyValue) {
		this.policyValue = policyValue;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public int compareTo(ServerInfo info) {
		if (this.weight > info.getWeight()) {
			return 1;
		} else if (this.weight < info.getWeight()) {
			return -1;
		}
		return 0;
	}

}
